package com.xuanmiao.smsback.common.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;

import javax.annotation.PostConstruct;
import java.util.TimeZone;

/**
 * pro环境下时区配置
 */
@Profile({"pro"})
@Configuration
public class TimeZoneConfig {

    @Value("${pro.config.time-zone}")
    private String defaultTimeZone;

    @PostConstruct
    void setDefaultTimezone() {
        TimeZone.setDefault(TimeZone.getTimeZone(defaultTimeZone));
    }

}
